#include "StdAfx.h"

#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") 

static CRITICAL_SECTION cs;
static bool initCS = true;
static FILE* debug = fopen("DebugLog.txt", "w");

#pragma comment(lib, "Dbghelp.lib")

void Log::Print(const char* format, ...)
{
	if(initCS)
	{
		InitializeCriticalSection(&cs);
		initCS = false;
	}
	EnterCriticalSection(&cs);
	
	va_list vl;
	va_start(vl, format);
	vfprintf(debug, format, vl);
	va_end(vl);
	fflush(debug);

	LeaveCriticalSection(&cs);
}